class Solution(object):
    def firstUniqChar(self, s):
        """
        :type s: str
        :rtype: int
        """
        letter = []
        count = []
        for i in range(len(s)):
            if s[i] not in letter:
                letter.append(s[i])
                count.append(1)
            else:
                count[letter.index(s[i])] += 1
        for i in range(len(count)):
            if count[i] == 1:
                return s.index(letter[i])
        else:
            return -1

a = Solution()
print(a.firstUniqChar("leetcode"))